package common;
import java.util.Vector;

/**
 * JavaBean component for paged display
 */

public class PageBean
{
    public int curPage;        // current page number
    public int maxPage;        // maximum page number
    public int maxRowCount;    // maximum row count
    public int rowsPerPage=10;  // number of rows per page
    public java.util.Vector data;   // AFIRS: storing departure flight(s)
    public java.util.Vector data2;  // AFIRS: storing return flight(s)
    public String UserID = null;
    public String CardType = null;
    public String CardNumber = null;
    public String UserAddr = null;
    public String ZipCode = null;
    public String State = null;
    public String City = null;
    
    public PageBean() {}
    
    // calculate the maximum page number using total number of rows
    public void countMaxPage() {   
        if (this.maxRowCount % this.rowsPerPage==0){
            this.maxPage = this.maxRowCount/this.rowsPerPage;
        }else{
            this.maxPage = this.maxRowCount/this.rowsPerPage + 1;
        }
    }

    public Vector getResult()
    {
    	return this.data;
    }
    
    public Vector getResult2()
    {
    	return this.data2;
    }

    public PageBean(PageBusiness pageBusiness)throws Exception
    {
        // this.maxRowCount = pageBusiness.getAvailableCount(); // get total number of rows
        this.data = pageBusiness.getResult(); //get the data which should be displayed in this page
        this.data2 = pageBusiness.getResult2();
        // this.countMaxPage();
    }

    public int getMaxRowCount() {
        return maxRowCount;
    }

    public void setMaxRowCount(int maxRowCount) {
        this.maxRowCount = maxRowCount;
    }
}
